/**
 * 
 */
package org.jenkon.assertion;

import java.util.List;
import java.util.Map;

/**
 * class with assertion methods for collections.
 * 
 * @author jkonopka
 * 
 */
public final class CollectionAssert {

	/**
	 * hide the public constructor for this util class.
	 */
	private CollectionAssert() {
	}
	
	/**
	 * check the {@link List} with values of is empty. if the {@link List} is
	 * not empty, then <code>throw new {@link IllegalArgumentException}</code>
	 * with the message 'the list is not empty'.
	 * 
	 * @see #isEmpty(List, String)
	 * @param values the {@link List} to check of is empty
	 * @throws IllegalArgumentException if the {@link Map} is not empty
	 * @throws NullPointerException if the {@link Map} is <code>null</code>
	 */
	public static void isEmpty(final List<?> values) {
		isEmpty(values, "the list is not empty");
	}

	/**
	 * check the {@link List} with values of is empty. if the {@link List} is
	 * not empty, then <code>throw new {@link IllegalArgumentException}</code>
	 * with the message.
	 * 
	 * @param values the {@link List} to check of is empty
	 * @param message the message of the {@link IllegalArgumentException} if the
	 *            {@link List} is empty
	 * @throws IllegalArgumentException if the {@link Map} is not empty
	 * @throws NullPointerException if the {@link Map} is <code>null</code>
	 */
	public static void isEmpty(final List<?> values, final String message) {
		if (!values.isEmpty()) {
			throw new IllegalArgumentException(message);
		}
	}

}
